package emulator.shell.commands;

import emulator.cbm.basic.BasicHelper;
import emulator.shell.DebugShell;
import emulator.shell.ShellCommand;

public class Sys implements ShellCommand {

	@Override
	public boolean execute(DebugShell shell, String[] arg) throws Exception {
		if (arg.length > 1)
		{
			try {
				int address = shell.parseAddress(arg[1]);
				BasicHelper.enterText("SYS"+Integer.toString(address)+"\n");
			}
			catch (NumberFormatException e) 
			{
				shell.getOut().println("Illegal argument: "+e.getMessage());
			}
		}
		return false;
	}

	@Override
	public void printHelp(DebugShell shell) {
		shell.getOut().println("command syntax:");
		shell.getOut().println("sys <address>  - basic command SYS");
	}

}
